home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / unix / cshel40a / part04 < prev   
Encoding:
Internet Message Format  |  1990-01-15  |  47.0 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i017: CShell 4.00A - alternative command interface, Part04/04
  5. Message-ID: <10990@xanth.cs.odu.edu>
  6. Date: 15 Jan 90 16:30:24 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: PERUGIA@ICNUCEVM.CNUCE.CNR.IT (Carlo & Cesare)
  9. Lines: 1489
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11.  
  12. Submitted-by: PERUGIA@ICNUCEVM.CNUCE.CNR.IT (Carlo & Cesare)
  13. Posting-number: Volume 90, Issue 017
  14. Archive-name: unix/cshell-4.00a/part04
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 4 (of 4)."
  23. # Contents:  shell.doc
  24. # Wrapped by tadguy@xanth on Mon Jan 15 11:28:12 1990
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'shell.doc' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'shell.doc'\"
  28. else
  29. echo shar: Extracting \"'shell.doc'\" \(44520 characters\)
  30. sed "s/^X//" >'shell.doc' <<'END_OF_FILE'
  31. X
  32. X        INSTRUCTIONS FOR SHELL Version: 4.00A 13-Jan-90
  33. X        ===============================================
  34. X
  35. X  Contents
  36. X  --------
  37. X
  38. X    O.    Changes over old versions
  39. X    I.    Description
  40. X    II.   Overview of Major features
  41. X    III.  Restrictions
  42. X    IV.   PIPES
  43. X    V.    Command Pre-processor
  44. X    VI.   Command Line Editing
  45. X    VII.  Function Keys
  46. X    VIII. Shell Commands
  47. X    IX.   Special Set Variables
  48. X    X.    Advanced Topics
  49. X    XI.   Example login file
  50. X    XII.  Example source files
  51. X    XIII. Default values
  52. X    XIV.  Why ARP ?
  53. X
  54. X
  55. X*********************************************************************************
  56. X* NOTE TO VERSION 4.00: THIS VERSION HAS A LOT OF IMPROVEMENTS OVER THE        *
  57. X* PREVIOUS ONES; WE EXPECT IT TO HAVE A BIT MORE BUGS THAN USUAL.        *
  58. X* WE HOPE ALL OF YOU WILL CONTINUE TO HELP US WITH SUGGESTIONS AND BUG REPORTS.    *
  59. X*                                         *
  60. X*         THANKS                                *
  61. X*            CARLO & CESARE                        *
  62. X*********************************************************************************
  63. X
  64. X
  65. XO.  Changes over old version
  66. X    ------------------------
  67. X
  68. XNew to 4.00A:
  69. X
  70. X- This version is called 4.00A because it is not 100% compatible with
  71. X  previous versions. We choose to accept this in order to better support
  72. X  the new ARP.library 1.3.
  73. X- External commands are searched in a different order than before; Shell
  74. X  path is now searched AFTER current directory, AmigaDOS path and C:.
  75. X- ARP pattern matching has been implemented (in part for line arg expanding,
  76. X  fully for search -w).
  77. X- Internal changes for various optimizations.
  78. X- Search command has been improved in several ways.
  79. X- New commands: basename, tackon.
  80. X- New options: if -v, resident -d, fornum -v -s, dir -n.
  81. X- Fixed bugs with dir (some dirs remained locked), foreach -v, htype
  82. X  (blanks were treated as binary), info (for devices > 32M).
  83. X- rback command now works ok (run, however, doesn't).
  84. X- Oh, I forgot: it also has an AREXX port... And you don't even have to get
  85. X  AREXX to use it. See new commands rxsend, rxrec
  86. X
  87. XNew to 3.03A:
  88. X
  89. X- New filter commands fltlower, fltupper.
  90. X- Added configuration file feature: now if you have a file named S:.login,
  91. X  it will be sourced for every Shell you start.
  92. X- New option dir -c.
  93. X- New editing feature: shift-left(right) arrow move cursor to previous(next)
  94. X  word.
  95. X- Bugs fixed: alias command wasn't listed in help; typing a number as a
  96. X  command was interpreted like 'alias'.
  97. X
  98. XNew to 3.02A:
  99. X
  100. X- New commands: fornum, forline, strleft, strright, strmid, strlen, exec.
  101. X- Improved commands: foreach, pri.
  102. X- New system variable _clinumber.
  103. X- You can now split long lines in source files (see source for details).
  104. X- window -q now lists also position of screens/windows, not only dimension.
  105. X- Since strings are handled directly from Shell with new commands,
  106. X  rpn is now used only for calculations; string commands are gone.
  107. X  However, now RPN is really usable.
  108. X- Changed rawgets() to fix some problems with function keys, multi-line
  109. X  editing and window resizing; also, fixed bug with ^E.
  110. X- cat now warns you if it can't find any file matching your pattern.
  111. X- Now uses DOS packets to get ptr to CLI window; this fixes a bug that
  112. X  caused problems if Shell was run on unactive windows.
  113. X- Fixed minor bugs (htype printed some more ASCII bytes, some commands
  114. X  returned random values, history didn't print CR's).
  115. X- Heavy mods to this file.
  116. X
  117. XNew to 3.01A:
  118. X
  119. X- Fixed bug with strings: before it printed strings with lenght 1 more
  120. X  than specified lenght.
  121. X- Made some additions and corrected many errors in Shell.doc (this file).
  122. X- Modified handler of external commands to allow things like DATE "?"
  123. X  (always use quotes).
  124. X- Corrected cat: it didn't work with STDIN before.
  125. X
  126. XI.  Description
  127. X    -----------
  128. X
  129. XThis version of Shell is the follow of:
  130. X    Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
  131. X    Shell V2.04M-V2.07M by Steve Drew
  132. X    Shell V2.08MI and V3.xxA by Carlo Borreo & Cesare Dieni
  133. X
  134. XSend suggestions/criticism/anything else to Carlo Borreo or Cesare Dieni at:
  135. X
  136. X    BITNET:  PERUGIA@ICNUCEVM.BITNET
  137. X    FIDONET: 2:332/23.0@FIDONET
  138. X
  139. Xor
  140. X    Carlo Borreo        Cesare Dieni
  141. X    Via G. Berio 34        Via G. Taddei 3
  142. X    I-18100 Imperia        I-56100 Pisa
  143. X    Italy            Italy
  144. X
  145. XYou may distribute this program for non-profit only.
  146. X
  147. X    Attributions
  148. X    ------------
  149. X
  150. XArexx is a program by William Hawes.
  151. XCygnus Ed Professional (C) 1988 CygnusSoft Software.
  152. X
  153. XII. OVERVIEW
  154. X    --------
  155. X
  156. XShell provides a convient AmigaDos alternative command interface.
  157. XAll its commands are internal and thus does not rely on the c:
  158. Xcommands for any functionality.
  159. X
  160. XMajor features include:
  161. X
  162. X    -command line editing
  163. X    -shell & Amigados search path support
  164. X    -simple history
  165. X    -redirection of any command
  166. X    -piping
  167. X    -aliases
  168. X    -variables & variable handling (embedded variables)
  169. X    -file name expansion via conventional wild carding ('?', '*' and more)
  170. X    -conditionals (if/else ect..)
  171. X    -source files  (w/ gotos and labels)
  172. X    -many built in commands to speed things up
  173. X
  174. X
  175. XIII. RESTRICTIONS
  176. X     ------------
  177. X
  178. X    o AmigaDos execute command will not work. Alternative is to use shell
  179. X      own script language (which is more powerful) or to do a 'run execute'.
  180. X    o VDK handler has a bug with setting file dates so when using the copy
  181. X      command and VDK you should use the -d switch otherwise your file date
  182. X      in vdk: will be bad. (This is not a bug with shell)
  183. X    o If using with conman it may be best to start shell with the -a switch
  184. X      (shell -a .login) to turn off shell's command line editing and use
  185. X      conmans instead.
  186. X
  187. X
  188. XIV. NOTES ON PIPES
  189. X    --------------
  190. X
  191. X    PIPES have been implimented using temporary RAM: files.  Thus, you
  192. X    should be careful when specifying a 'ram:*' expansion as it might
  193. X    include the temp. files.  These files are deleted on completion of
  194. X    the pipe segment.
  195. X
  196. X    The file names used are completely unique, even with multiple shell
  197. X    running simultaniously.
  198. X
  199. X    My favorite new feature is the fact that you can now redirect to and
  200. X    from, and pipe internal commands.  'echo charlie >ram:x', for
  201. X    instance.  Another favorite:
  202. X
  203. X       echo "echo mem | shell" | shell
  204. X
  205. X    To accomplish these new features, I completely re-wrote the command
  206. X    parser in execom.c
  207. X
  208. X    NO BCPL program should be output-append redirected (>>).
  209. X
  210. X
  211. XV.  COMMAND PRE-PROCESSOR
  212. X    ---------------------
  213. X
  214. X    Preprocessing is done on the command line before it is passed on to
  215. X    an internal or external routine:
  216. X
  217. X    ^c    where c is a character is converted to that control character.
  218. X        Thus, say '^l' for control-l.
  219. X
  220. X    $name    where name is a variable name.  Variable names can consist of
  221. X        0-9, a-z, A-Z, and underscore (_).  The contents of the
  222. X        specified variable is used.  If the variable doesn't exist,
  223. X        the specifier is used.  That is, if the variable 'i' contains
  224. X        'charlie', then '$i' -> 'charlie'.  If the variable 'i' doesn't
  225. X        exist, then '$i'->'$i' .
  226. X
  227. X    ;    delimits commands.   echo charlie ; echo ben.
  228. X
  229. X    ' '    (a space). Spaces delimit arguments.
  230. X
  231. X    "string" a quoted string.  For instance, if you want to echo five spaces
  232. X        and an 'a':
  233. X
  234. X        echo      a       -> a
  235. X        echo "    a"      ->      a
  236. X
  237. X    \c    overide the meaning of special characters.  '\^a' is a
  238. X        circumflex and an a rather than control-a.  To get a backslash,
  239. X        you must say '\\'.
  240. X
  241. X        also used to overide alias searching for commands.
  242. X
  243. X    >file    specify output redirection.  All output from the command is
  244. X        placed in the specified file.
  245. X
  246. X    >>file    specify append redirection (Does not work with BCPL programs).
  247. X
  248. X    <file    specify input redirection. The command takes input from the
  249. X        file rather than the keyboard (note: not all commands require
  250. X        input; it makes no sense to say 'echo <charlie' since
  251. X        the 'echo' command only outputs its arguments).
  252. X
  253. X    |    PIPE specifier.  The output from the command on the left becomes
  254. X        the input to the command on the right.  The current SHELL
  255. X        implimentation uses temporary files to store the data.
  256. X
  257. X    !!    execute the previously executed command.
  258. X    !nn    (nn is a number).  Insert the history command numbered n (see
  259. X        the HISTORY command)
  260. X    !partial search backwards through the history list for a command which
  261. X        looks the same as 'partial', and execute it.
  262. X
  263. X    #    Enter comment.  The rest of the line is discarded (note: \#
  264. X        will, of course, overide the comment character's special
  265. X        meaning)
  266. X
  267. X
  268. XVI. COMMAND LINE EDITING
  269. X    --------------------
  270. X
  271. X    o Command line can be upto 255 chars.
  272. X    o Inserts and deletes are handled correctly over multiple screen lines.
  273. X    o Shell will keep track of the line width should the window get resized.
  274. X
  275. X    KEY DEFINITIONS:
  276. X        Up Arrow    Recall previous commands
  277. X        Down Arrow  Recall commands
  278. X        Left Arrow  Move cursor about command line.
  279. X        Right Arrow  "     "      "      "      "
  280. X        Shift-Up Arrow    Get start of history
  281. X        Shift-Down Arrow   "  end   "     "
  282. X        Shift-Left Arrow  Moves cursor a word left
  283. X        Shift-Right Arrow   "     "    "  "   right
  284. X        ^A        Toggle insert/overtype mode.
  285. X        ^D        EOF (exits Shell)
  286. X        ^E        Put cursor at end of text.
  287. X        ^K        Delete to end of line.
  288. X        ^R        Retype current line.
  289. X        ^U        Erase entire line.
  290. X        ^X        Erase entire line.
  291. X        ^Z        Put cursor at start of text.
  292. X        f1 - f10    Execute command if variable exists.
  293. X        F1 - F10    More commands (Shifted f keys).
  294. X        Help        Invokes help command
  295. X
  296. X
  297. XVII. FUNCTION KEYS
  298. X     -------------
  299. X
  300. X    Function keys now insert text to the current position on the command
  301. X    line. They maybe terminated with a ^M (return). f1 would be non shifted
  302. X    where as F1 is shifted.
  303. X    Most of functions key have a default definition, but it may be changed.
  304. X
  305. X      $ set f1 dir df0:^M
  306. X
  307. X    will add the text 'dir df0:<return>' to the current line.
  308. X
  309. X      $ set f1 dir
  310. X
  311. X    would only add 'dir' you could then enter ' df0:<return>'
  312. X
  313. X
  314. XVIII. SHELL COMMANDS
  315. X      ---------------
  316. X
  317. X   First to start shell from a CLI
  318. X
  319. X   shell [-a] [-c command;command]
  320. X
  321. X   where:
  322. X    -a disables all command line editing features. This is useful for
  323. X    when running shell over AUX:, and necessary if you are running
  324. X    CONMAN.
  325. X
  326. X    -c allows execution of one command line and then exits out of shell.
  327. X    This is useful for running a internal shell commands in the
  328. X    background or from an external application. eg:
  329. X
  330. X        Run shell -c dir df0:; copy -r df0: df1: >nil:; echo "Done"
  331. X
  332. X    If you 'Run' shell in the background without the -c switch shell
  333. X    will detect this and imediatley exit.
  334. X
  335. X   Command execution:
  336. X
  337. X   Internal shell commands maybe abreviated.
  338. X
  339. X   The first argument is the command-name... here is (in order) how Shell
  340. X   tries to execute it:
  341. X
  342. X    1) Alias list is searched for an alias exactly matching name.
  343. X    2) Internal commands list is scanned for a command even partially
  344. X       matching name (so you can, for instance, say resi for resident;
  345. X       however, you should specify enough of a command to be unique).
  346. X    3) ARP resident list is scanned (you can use Shell's resident
  347. X       command to add/remove a file in this list).
  348. X    4) At this point, command is supposed to be external (disk), and
  349. X       is searched before in current directory, then in AmigaDOS
  350. X       path, in C:, and finally in Shell path.
  351. X    5) As a last chance, AUTOMATIC SOURCING is tried, first in
  352. X           current directory, then in Shell path.
  353. X
  354. X   AUTOMATIC SOURCING may be accomplished by naming shell scripts with a
  355. X   .sh suffix.  Thus, if you say 'stuff' and the file 'stuff.sh' exists in
  356. X   your current or anywhere in Shell search path, it will be SOURCED with
  357. X   any arguments you have placed in the $_passed variable.
  358. X   This is equivalent to typing 'source stuff.sh'
  359. X
  360. X   Wild card expansions:
  361. X    Most shell commands will accept multiple arguments that can
  362. X    be as a result of wild card expansion. Also when the calling
  363. X    an external command shell will first expand any wild cards
  364. X    to seperate arguments. If you wish to have the external command
  365. X    handle it's own wild carding you will need to insert quotes
  366. X    around the special wild card characters.
  367. X
  368. X    eg.
  369. X        arc a new.arc *.txt    - shell will expand and pass to arc
  370. X        arc a new.arc "*.txt"    - let arc expand the wild cards.
  371. X
  372. X    Wild card expansions:
  373. X
  374. X    ?    match any single character
  375. X    *    match any string
  376. X    .../*    recursive search down ALL sub directories from current level
  377. X    ~    exclude pattern matching specifier
  378. X    !    synonim for ~, supported for compatibility
  379. X    &    prefixed to patterns, ask confirmation for each file
  380. X    []    character class
  381. X
  382. X    Examples:
  383. X
  384. X    df0:.../*        all files in all directories on df0:
  385. X    df0:.../!*.info     full directory tree of df0: but exclude
  386. X                any ugly .info files.
  387. X    !*.o !*.c        will result in ALL files matching since what
  388. X                doesn't match the !*.o will match the !*.c
  389. X    df1:&*            all files in root of df1:, but ask 
  390. X                confirmation for each
  391. X    *.[co]            all files ending in .c or .o
  392. X    ~*.[co]            all files NOT ending in .c nor in .o
  393. X
  394. X
  395. X    The following symbols are not yet supported by wild card expansions,
  396. X    but are accepted in search -w.
  397. X
  398. X    ( | )    OR matching
  399. X    #    0 or more times the pattern following
  400. X
  401. X    Examples:
  402. X
  403. X    k#a        matches ka, kaa, kaaa, etc.
  404. X    hel(lo|p)    matches hello or help.
  405. X
  406. X
  407. X    LIST OF COMMANDS:
  408. X    -----------------
  409. X
  410. X    ABORTLINE
  411. X    Usage    : abortline
  412. X    Example    : echo a;abort;echo b
  413. X    Results    : a
  414. X
  415. X    Causes the rest of the line to be aborted. Intended for use in
  416. X    conjunction with exception handling.
  417. X
  418. X    ADDBUFFERS
  419. X    Usage    : addbuffers drive buffers
  420. X    Example    : addbuffers df0: 24
  421. X
  422. X    Just like AmigaDOS addbuffer command, causes new buffers to be
  423. X    allocated for disk I/O. Each buffer costs 512 bytes of CHIP memory.
  424. X
  425. X    ALIAS
  426. X    Usage    : alias [name [command string] ]
  427. X    Example    : alias vt "echo Starting VT100;run sys:tools/vt100"
  428. X
  429. X    Sets a name to be a string. You can alias a single name to a set
  430. X    of commands if you enclose them in quotes as above. By simply
  431. X    typing vt, the command line above would be executed.
  432. X
  433. X    Argument Passing to an Alias:
  434. X
  435. X    Usage    : alias name "%var [command string]"
  436. X    Example    : alias xx "%q echo hi $q, how are ya."
  437. X          xx Steve
  438. X    Results    : hi Steve, how are ya.
  439. X
  440. X    The second form of the alias command allows passing of arguments
  441. X    to any position within the command string via use of a variable
  442. X    name. To pass arguments to the end of a command string this method
  443. X    is actually not necessary.
  444. X
  445. X    Typing "alias name" you will get the alias for that name, while with
  446. X    "alias" you get a list of all alias.
  447. X
  448. X    ASET
  449. X    Usage    : aset name value
  450. X    Example    : aset INCLUDE include:
  451. X
  452. X    Set a variable in a way that is compatible with Aztec SET command;
  453. X    this is completely different from Shell variable.
  454. X    May even be used to set ARP variables.
  455. X
  456. X    ASSIGN
  457. X    Usage    : assign [logical [physical] ]
  458. X    Example    : assign C: df1:c
  459. X
  460. X    Use it like AmigaDOS assign command to set, remove or list
  461. X    assignments of logical names to directories.
  462. X
  463. X    BASENAME
  464. X    Usage    : basename var path
  465. X    Example    : basename x df0:c/Dir    # sets x to "Dir"
  466. X
  467. X    Sets var specified to basename of path.
  468. X
  469. X    CAT
  470. X    Usage    : cat [-n][file file....]
  471. X    Example    : cat foo.txt
  472. X
  473. X    Type the specified files onto the screen.  If no file is specified,
  474. X    STDIN in used.  CAT is meant to output text files only.
  475. X    Specifying -n option you will get numbered lines.
  476. X
  477. X    CD
  478. X    Usage    : cd [path]
  479. X    Example    : cd df0:devs/printers
  480. X
  481. X    Change your current working directory.  You may specify '..' to go
  482. X    back one directory (this is a CD specific feature, and does not
  483. X    work with normal path specifications).
  484. X
  485. X    CD without any arguments displays the path of the directory you
  486. X    are currently in.
  487. X
  488. X    CLOSE
  489. X    Usage    : close filenumber
  490. X
  491. X    Close the specified file opened by open.
  492. X    See open and flist for more info.
  493. X
  494. X    COPY
  495. X    (CP)
  496. X    Usage    : copy [-u][-d] file file
  497. X    or    : copy [-u][-d] file1 file2...fileN dir
  498. X    or    : copy [-r][-u][-d] dir1 dir2...dirN dir
  499. X    options    :
  500. X        -r    recursive, copy all subdirectories as well.
  501. X        -u    update, if newer version exist on dest, don't copy
  502. X        -d    don't set destination file date to that of source.
  503. X
  504. X    Example    : copy -r df0: df1:
  505. X
  506. X    Copy files or directories. When copying directories, the -r option
  507. X    must be specified to copy subdirectories as well.  Otherwise, only
  508. X    top level files in the source directory are copied.
  509. X
  510. X    All files will be displayed as they are copied and directory's
  511. X    displayed as they are created. This output can be suppessed by
  512. X    redirecting to nil: eg. copy -r >nil: df0: df1:
  513. X
  514. X    Copy will abort after current file on Control-C.
  515. X
  516. X    Copy by default sets the date of the destination file to that of
  517. X    the source file. To overide this feature use the -d switch.
  518. X
  519. X    Another useful option is the -u (update) mode were copy will not
  520. X    copy any files which exists already in the destination directory
  521. X    if the destination file is newer or equal to the source file.
  522. X    This is useful when developing code say in ram: eg. 'copy *.c ram:'
  523. X    when done you can copy -u ram: df1: and only those modules you have
  524. X    modified will be copied back.
  525. X
  526. X    Copy command will now create the destination directory if it does
  527. X    not exist when specified as 'copy [-r] dir dir'. If you specify
  528. X    copy file file file dir, then 'dir' must already exist.
  529. X
  530. X    CP
  531. X    Equivalent to copy.
  532. X
  533. X    DATE
  534. X    Usage    : date [new date and/or time]
  535. X    Example    : date Wednesday  # this refers to NEXT wed, of course
  536. X
  537. X    Used to read or set system date and/or time. All standard options
  538. X    may be used (yesterday, tomorrow, monday, etc.).
  539. X    Leading zero's are not necessary.
  540. X    Without parameters shows Dddddd DD-MMM-YY HH:MM:SS.
  541. X
  542. X    DEC
  543. X    Usage    : dec varname [value]
  544. X    Example    : dec abc
  545. X
  546. X    Decrement the numerical equivalent of the variable with specified
  547. X    value (default: 1) and place the ASCII-string result back into
  548. X    that variable.
  549. X
  550. X    DELETE
  551. X    (RM)
  552. X    Usage    : delete [-p][-r] file file file...
  553. X    Example    : delete foo.txt test.c
  554. X
  555. X    Remove (delete) the specified files.  Remove always returns
  556. X    errorcode 0.  You can remove empty directories.  The '-r' option
  557. X    will remove non-empty directories by recursively removing all sub
  558. X    directories.
  559. X    You can remove delete-protected files specifying -p option.
  560. X    If you specify any wildcard deletes the files will be listed as
  561. X    they are deleted. This can be suppressed by redirecting to nil:
  562. X
  563. X    DIR
  564. X    (LS)
  565. X    Usage    : dir [-sdfcn] [path path ... ]
  566. X    Example    : dir df0:
  567. X    options    :
  568. X        -s  short multi(4) column display.
  569. X        -d  list directories only
  570. X        -f  list files only
  571. X        -c  don't change colors for directories (useful to printer)
  572. X        -n  display names only
  573. X
  574. X    Displays a directory of specified files. Default output shows
  575. X    date, protection, block size, byte size and total space used.
  576. X    Protections flags include new 1.2/1.3 flags (see under protect).
  577. X    Files are alphabetically sorted, without case sensitivity, and
  578. X    directories are in red pen (unless you use -c).
  579. X
  580. X    DISKCHANGE
  581. X    Usage    : diskchange drive
  582. X
  583. X    Like AmigaDOS diskchange.
  584. X
  585. X    ECHO
  586. X    Usage    : echo [-n] string
  587. X    Example    : echo hi there
  588. X    Results    : hi there
  589. X
  590. X    Echo the string given. If -n switch given no newline is
  591. X    appended.
  592. X
  593. X    ELSE ;
  594. X    Usage    : else ; command
  595. X    Usage    : if -f foo.c ; else ; echo "Not there" ; endif
  596. X
  597. X    Else clause, must follow an IF statement.
  598. X
  599. X    ENDIF
  600. X    Usage    : endif
  601. X
  602. X    The end of an if statement.
  603. X
  604. X    Note: if you return from a script file with unterminated IF's
  605. X    and the last IF was false, prompt will be changed to an
  606. X    underscore ('_') and no commands will be executed until
  607. X    'endif' is typed.
  608. X
  609. X    EXEC
  610. X    Usage    : exec command
  611. X    Example    : set util SYS:sytem/utilities
  612. X          exec $util/make    # would not work without exec
  613. X
  614. X    Execute the command specified; exec command is equivalent to
  615. X    command, only you can use variables to specify command name.
  616. X
  617. X    FAULT
  618. X    Usage    : fault error1 .. errorN
  619. X    Example    : fault 205 212
  620. X
  621. X    Like AmigaDOS fault, prints specified error messages.
  622. X
  623. X    FILENOTE
  624. X    Usage: filenote file1 .. filen  note
  625. X
  626. X    Set AMIGADOS comment of the specified file. This is not very useful,
  627. X    since in current implementation of Shell file comments are not listed
  628. X    in directory, but it was so easy to implement...
  629. X
  630. X    FLIST
  631. X    Usage    : flist
  632. X
  633. X    Lists the filenumbers of files opened by open.
  634. X    See open and close for more info.
  635. X
  636. X    FLTLOWER
  637. X    Usage    : fltlower
  638. X    Example    : dir | fltlower
  639. X    Or    : fltlower <readme
  640. X
  641. X    This is a filter command, i.e. it reads from stdin and writes to
  642. X    stdout. The more natural way to use it is a pipe, or it can be
  643. X    redirected.
  644. X    Its purpose is to convert all alphabetic to lower case.
  645. X
  646. X    FLTUPPER
  647. X    The same of fltlower, only this converts to upper case.
  648. X
  649. X    FOREACH
  650. X    Usage    : foreach [-v] varname ( strings ) command
  651. X    Example    : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
  652. X    Result    : a ha
  653. X          b ha
  654. X          c ha
  655. X          d ha
  656. X
  657. X    'strings' is broken up into arguments.  Each argument is placed in
  658. X    the variable 'varname' in turn and 'command' executed.  To execute
  659. X    multiple commands, place them in quotes.
  660. X
  661. X    Foreach is especially useful when interpreting passed arguments in
  662. X    an alias.
  663. X
  664. X    eg.
  665. X        foreach i ( *.pic ) viewilbm $i
  666. X    assuming a.pic and b.pic in current directory the following commands
  667. X    will occur:
  668. X        viewilbm a.pic
  669. X        viewilbm b.pic
  670. X
  671. X    Flag -v causes arguments to be displayed every time command is
  672. X    executed.
  673. X
  674. X    FOREVER
  675. X    Usage    : forever command
  676. X    or    : forever "command;command;command..."
  677. X
  678. X    The specified commands are executed over and over again forever.
  679. X
  680. X    -Execution stops if you hit ^C
  681. X    -If the commands return with an error code.
  682. X
  683. X   FORLINE
  684. X    Usage    : forline var filename command
  685. X    or    : forline var filename "command;command..."
  686. X    Example    : forline i RAM:temp "echo line $_linenum=$i"
  687. X
  688. X    For each ASCII line of file specified commands are executed and
  689. X    var points to line content. You can check system variable _linenum
  690. X    to find the number of the line currently read.
  691. X
  692. X   FORNUM
  693. X    Usage    : fornum [-v] var n1 n2 command
  694. X    or    : fornum [-v] -s var n1 n2 step command
  695. X    Example    : fornum -v x 1 10 echo $1
  696. X    or    : fornum -s x 10 1 -1 echo $i # counts backwards
  697. X
  698. X    Executes command(s) for all numerical values of x between n1 and n2.
  699. X    If more than one command is specified, or command is redirected,
  700. X    include command(s) in quotes.
  701. X    Switch -v (verbose) causes printing of progressive numbers.
  702. X    Switch -s allows you to specify a step; if this is negative, the
  703. X    count will be backwards.
  704. X
  705. X   GOTO
  706. X    Usage    : goto label
  707. X    Example    :
  708. X          label start
  709. X            echo "At start"
  710. X            dir ram:
  711. X            goto start
  712. X
  713. X    Goto the specified label name.  You can only use this command from a
  714. X    source file. Labels may now be forward or reverse from current
  715. X    position.
  716. X
  717. X    HELP
  718. X    Usage    : help
  719. X    Example    : help
  720. X
  721. X    Simply displays all the available commands.  The commands are
  722. X    displayed in search-order.  That is, if you give a partial name
  723. X    the first command that matches that name in this list is the one
  724. X    executed.  Generally, you should specify enough of a command so that
  725. X    it is completely unique.
  726. X
  727. X    HISTORY
  728. X    Usage    : history [partial_string]
  729. X    Example    : history
  730. X
  731. X    Displays the enumerated history list.  The size of the list is
  732. X    controlled by the _history variable.  If you specify a partial-
  733. X    string, only those entries matching that string are displayed.
  734. X
  735. X    HOWMANY
  736. X    Usage    : howmany
  737. X
  738. X    This command tells you how many instances of Shell are running
  739. X    in your system.
  740. X
  741. X    HTYPE
  742. X    Usage    : htype file1 .. filen
  743. X
  744. X    Displays the specified files in hex and ASCII, just like the system
  745. X    command Type file opt h. Especially suitable for binary files.
  746. X
  747. X    IF
  748. X    Usage    : if [-n] argument conditional argument ;
  749. X    or    : if [-n] argument
  750. X    or    : if [-n] -f file
  751. X    or    : if [-n] -d file/dir
  752. X    or    : if [-n] -m
  753. X    or    : if [-n] -t file file1 .. fileN
  754. X    or    : if [-n] -r rpnexpression
  755. X    or    : if [-n] -v varname
  756. X
  757. X    If a single argument is something to another argument.  Conditional
  758. X    clauses allowed:
  759. X
  760. X    <, >, =, and combinations (wire or).  Thus <> is not-equal, >=
  761. X    larger or equal, etc...
  762. X
  763. X    If arguments are not numeric, they are compared as strings.
  764. X
  765. X    Usually the argument is either a constant or a variable ($varname).
  766. X
  767. X    The second form if IF is conditional on the existance of the argument.
  768. X    If the argument is a "" string, then false , else TRUE.
  769. X
  770. X    The third form of IF used by -f switch checks for existance of
  771. X    the specified file.
  772. X
  773. X    Switch -d tests the type of the object specified: if it is a
  774. X    directory, then TRUE; if it is a file (or it doesn't exist)
  775. X    then FALSE.
  776. X
  777. X    Switch -m is used to test if FAST memory is present, i.e. wheter
  778. X    more than 512K RAM are available.
  779. X    Example (to be included in a login.sh file):
  780. X    if -m; resident -d lc1 lc2 blink; endif
  781. X
  782. X    Using -t form compares the date and time of the first file with
  783. X    all the others; if the first is younger than ALL the others, then
  784. X    FALSE, else TRUE. If a file doesn't exists, it is considered as
  785. X    being older.
  786. X    This feature is especially useful for building makefiles without
  787. X    using any MAKE utility.
  788. X    Example:
  789. X    if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
  790. X
  791. X    Option -r evaluates a given RPN expression (see under RPN for more
  792. X    info): if value on top of stack is 0, then FALSE, else TRUE.
  793. X
  794. X    Switch -n (NOT) reverses the result.
  795. X
  796. X    To test if a given variable is defined, use if -v varname.
  797. X
  798. X    When using 'IF' command interactively if you are entering commands
  799. X    following an 'IF' that was false, the prompt will be set to a
  800. X    underscore '_ ' to indicate all commands will be ignored until
  801. X    an 'ELSE' or 'ENDIF' command is seen.
  802. X
  803. X    INC
  804. X    Usage    : inc varname [value]
  805. X    Example    : inc abc 5
  806. X
  807. X    Increment the numerical equivalent of the variable with specified
  808. X    value (default: 1) and place the ascii-string result back into
  809. X    that variable.
  810. X
  811. X    INFO
  812. X    Usage    : info
  813. X
  814. X    Display Device statistics for all the disk-type devices in system
  815. X    (DFk:, HDk, JHk:, RAM:, RDk: ...), just like the system command
  816. X    info. Gives block used/free, % used, errs, status and volume name.
  817. X
  818. X    INPUT
  819. X    Usage    : input var var ... var
  820. X    Example    : input abc
  821. X
  822. X    Input from STDIN (or a redirection, or a pipe) to a variable.  The
  823. X    next input line is placed in the variable.
  824. X
  825. X    JOIN
  826. X    Usage    : join [-r] file1..fileN destfile
  827. X    Example    : join part1 part2 part3 total
  828. X
  829. X    Joins the specified files to get destfile. If destfile already
  830. X    exists, an error message is generated and operation is aborted,
  831. X    unless you specify -r (replace) option.
  832. X
  833. X    LABEL
  834. X    Usage    : label name
  835. X
  836. X    Create a program label right here. Used in source files, can then
  837. X    GOTO a label.
  838. X
  839. X    LS
  840. X    Equivalent to dir.
  841. X
  842. X    MD
  843. X    Equivalent to mkdir.
  844. X
  845. X    MEM
  846. X    Usage    : mem
  847. X
  848. X    Display current memory statistics for CHIP memory and
  849. X    FAST memory (if any installed).
  850. X
  851. X    MKDIR
  852. X    (MD)
  853. X    Usage    : mkdir name name name...
  854. X    Example    : mkdir df0:stuff
  855. X
  856. X    Create the specified directories.
  857. X
  858. X    MV
  859. X    Equivalent to rename.
  860. X
  861. X    OPEN
  862. X    Usage    : open filename filemode filenumber
  863. X    Example    : open RAM:data w 1
  864. X
  865. X    This allows you to open a file, redirect to it as many commands
  866. X    as you like, then close it.
  867. X    Filename is any valid AmigaDOS filename, filemode is either r
  868. X    for read or w for write, filenumber is a number between 1 and 10.
  869. X    To redirect a program to or from an open file, use as your redir
  870. X    filename a dot followed by the filenumber.
  871. X    Here is a complete example:
  872. X
  873. X        open RAM:data w 1
  874. X        echo -n 2+2= >.1
  875. X        rpn 2 2 + . CR >.1
  876. X        close 1
  877. X        type RAM:data    # will display 2+2=4
  878. X    See also close, flist.
  879. X
  880. X    PATH
  881. X    Usage    : path
  882. X
  883. X    Used to list AmigaDOS path. In current version can't be used to
  884. X    set it.
  885. X
  886. X    PRI
  887. X    Usage    : pri clinumber pri
  888. X    Example    : pri 3 5    # set priority of cli #3 to 5
  889. X
  890. X    Change the priority of the specified task (use PS command to
  891. X    determine clinumber). If you specify 0 as clinumber you can
  892. X    change priority of "this" task (the one executing shell).
  893. X
  894. X    PROTECT
  895. X    Usage    : protect file1 ... filen [flags]
  896. X    Example    : protect myfile rwe
  897. X
  898. X    Set AMIGADOS file protection flags for the file specified. Valid
  899. X    flags are h, s, p, a, r, w, e, d.
  900. X    If you don't specify the flags, all flags are cleared.
  901. X    Bit 'a' is new to WorkBench 1.2, while 'h', 's', 'p' are new to 1.3.
  902. X
  903. X    PS
  904. X    Usage    : ps
  905. X
  906. X    Gives status of DOS processes.  eg:
  907. X
  908. X    Proc Command Name    CLI Type    Pri.  Address  Directory
  909. X     1   SHELL        Initial CLI   0      97b0  Stuff:shell
  910. X     2   sys:c/clockmem    Background  -10    2101a8  Workdisk:
  911. X     3   c:emacs        Background    0    212f58  Stuff:shell
  912. X     4   sys:c/VT100    Background    0    227328  Workdisk:
  913. X
  914. X    Address is the addres of the task, directory is the process
  915. X    currently CD'd directory.
  916. X
  917. X    PWD
  918. X    Usage    : pwd
  919. X
  920. X    Rebuild _cwd by backtracing from your current directory.
  921. X
  922. X    QUIT
  923. X    Usage    : quit
  924. X
  925. X    Quit out of Shell back to CLI.
  926. X
  927. X    RBACK
  928. X    Usage    : rback command
  929. X
  930. X    Start a new process executing the specified command, but can't do
  931. X    input/output. Equivalent to 'run command >NIL: <NIL:'.
  932. X
  933. X    RENAME
  934. X    (MV)
  935. X    Usage    : rename from to
  936. X    or    : rename from from from ... from todir
  937. X
  938. X    Allows you to rename a file or move it around within a disk.
  939. X    Allows you to move 1 or more files into a single directory.
  940. X
  941. X    RESIDENT
  942. X    Usage    : resident [-r][-d] [files]
  943. X    Example    : resident lc1 lc2 blink    # load these as resident
  944. X          resident -d lc1 lc2 blink    # defer load when needed
  945. X          resident -r lc1 lc2 blink    # remove these
  946. X          resident            # list resident programs
  947. X
  948. X    This is ARP resident. Commands are searched by Shell in resident
  949. X    list BEFORE of searching on any external device.
  950. X    Only PURE programs can run as resident, see ARP docs for more info.
  951. X    Option -d is very useful: you can say, in your startup file,
  952. X    resident -d file...file; programs will not be loaded immediately,
  953. X    but only when you will try to load them. This way, you will not
  954. X    waste memory and startup time if you don't use the programs.
  955. X    Old option -a has no more effect.
  956. X
  957. X    RETURN
  958. X    Usage    : return [n]
  959. X    Example    : return 10
  960. X
  961. X    Exit from a script file, or quit from shell with optional
  962. X    exit code.
  963. X
  964. X    RM
  965. X    Equivalent to delete.
  966. X
  967. X    RPN
  968. X    Usage    : rpn expression
  969. X    Example    : rpn 3 7 *    # Prints the value 21
  970. X
  971. X    Evaluate an RPN expression, using 32-bit values. In older versions
  972. X    of Shell RPN contained string functions too, but now that strings
  973. X    are handled by specifical commands, these are no more needed.
  974. X    At end of evaluation, RPN prints values on stack, so you can
  975. X    say for instance "rpn $x 2 * | input x" to double the value of
  976. X    variable x.
  977. X    Functions implemented are:
  978. X
  979. X        + - * /    Obvious meaning; / means integer division, of course
  980. X        %        Module operator e.g. "rpn 7 3 %" answers 1
  981. X        & | ~    Bitwise and, or, not operators
  982. X        > < ==    Tests for greater-than, lower-than, equal. To get
  983. X            a test for >= (or <=), you can use < ! (or > !)
  984. X        !        Logical not operator
  985. X        DUP        Duplicate value on top of stack
  986. X        DROP    Drop value on top of stack
  987. X        SWAP    Swap two values on top of stack
  988. X
  989. X    RUN
  990. X    Usage    : run prgm args
  991. X    Example    : run emacs test.c
  992. X
  993. X    Start a new process executing the specified command.
  994. X    In current implementation run command can't be redirected.
  995. X    This command is not fully reliable: use at your own risk.
  996. X    See also rback.
  997. X
  998. X    RXREC
  999. X    Usage    : rxrec [portname]
  1000. X
  1001. X    Create an AREXX-compatible port of the specified name (defaults to
  1002. X    "rexx_csh"), then puts Shell to sleep waiting for messages on it.
  1003. X
  1004. X    CAUTION: the only way to exit from this status is to send to the port
  1005. X    the message "bye".
  1006. X
  1007. X    Example:
  1008. X    Open two Shell's in two separate CLI's. From the first, type:
  1009. X
  1010. X        rxrec
  1011. X
  1012. X    Now first Shell doesn't respond to keyboard input; instead, it waits
  1013. X    for messages on a port called "rexx_csh". Now, from the other, type:
  1014. X
  1015. X        rxsend rexx_csh "dir df0:"
  1016. X
  1017. X    You will see the listing of df0: in the first Shell. Experiment as you
  1018. X    like, then:
  1019. X
  1020. X        rxsend rexx_csh bye
  1021. X
  1022. X    And all will return to normal.
  1023. X
  1024. X    RXSEND
  1025. X    Usage    : rxsend portname commands
  1026. X
  1027. X    Send a command to any program with an AREXX-compatible port.
  1028. X    You don't have to load anything to use these command (or rxrec):
  1029. X    all you need is a program with the right port.
  1030. X
  1031. X    An example is CygnusEdProfessional: here is, for instance, a command
  1032. X    to wake it up, load the file test.c and jump to line 20:
  1033. X
  1034. X        rxsend rexx_ced cedtofront "open test.c" "jmp to line 20"
  1035. X        # rexx_ced is the name of AREXX port for CygnusEd
  1036. X
  1037. X    Refer to your application manual for details and for the name of the
  1038. X    port.
  1039. X
  1040. X    SEARCH
  1041. X    Usage    : search [-w][-c][-n][-r][-e][-q] filelist string
  1042. X
  1043. X    Search specified files for a string. Only lines containing the
  1044. X    specified strings are displayed.
  1045. X
  1046. X    If the filename is STDIN (in uppercase) the standard input is
  1047. X    used, so you can use search as the destination for a pipe.
  1048. X    Example:
  1049. X        strings myprog 8 | search STDIN .library
  1050. X    Lists all libraries used in "myprog".
  1051. X
  1052. X    If you specify any directory in filelist, and use the -r (recurse)
  1053. X    switch, all files in directory are recursively searched.
  1054. X
  1055. X    Lines are numbered for default; use -n (number) switch to turn off
  1056. X    line numbering.
  1057. X
  1058. X    Search is normally not case sensitive; use -c (case) flag to turn ON
  1059. X    case sensitivity.
  1060. X
  1061. X    By specifying -e (exclude) switch, only lines NOT containing the
  1062. X    specified string are listed.
  1063. X
  1064. X    Using -w (wild) flag, only the lines matching with the string are
  1065. X    listed.
  1066. X    Notes to wild card matching;
  1067. X    - Uses Shell standard matching.
  1068. X    - All standard ARP wildcards are allowed * ? [] () | ~ ' #
  1069. X    - The WHOLE line must match the string, not only a substring.
  1070. X    - String MUST be enclosed in quotes to avoid wildcard expansion
  1071. X
  1072. X    Flag -q (quiet) suppresses printing of file names.
  1073. X
  1074. X    Examples:
  1075. X        search -cr df0:include ACCESS
  1076. X    Find all occurrencies of ACCESS (in uppercase) in all files
  1077. X    contained in include directory.
  1078. X        search -w shell.h "'#define*"
  1079. X    Lists only lines of file beginning with (not simply containing)
  1080. X    #define. Note the use of ' to escape the special symbol #.
  1081. X
  1082. X    SET
  1083. X    Usage    : set [name] [string]
  1084. X    Example    : set abc hello
  1085. X
  1086. X    Set with no args lists all current variable settings.
  1087. X    Set with one arg lists the setting for that particular variable.
  1088. X    Specifying name and string, stores the string into variable name.
  1089. X
  1090. X    Also See the section on special _variables.
  1091. X
  1092. X
  1093. X    SLEEP
  1094. X    Usage    : sleep timeout
  1095. X    Example    : sleep 10
  1096. X
  1097. X    Sleep for 'timeout' seconds, or until ^C typed.
  1098. X
  1099. X    STACK
  1100. X    Usage    : stack [number]
  1101. X    Example    : stack 8000
  1102. X
  1103. X    Changes the default stack for this CLI. Without arguments, prints
  1104. X    it.
  1105. X
  1106. X    STRHEAD
  1107. X    Usage    : strhead varname breakchar string
  1108. X    Example    : strhead x . foobar.bas    # Will set x to "foobar"
  1109. X
  1110. X    Remove everything after and including the breakchar in 'string' and
  1111. X    place in variable 'varname'.
  1112. X
  1113. X    STRINGS
  1114. X    Usage    : strings file1..fileN minlenght
  1115. X    Example    : strings c:dir c:list shell 7
  1116. X
  1117. X    Prints strings contained in specified files (usually binary)
  1118. X    with lenght >= minlenght.
  1119. X
  1120. X    STRLEFT
  1121. X    Usage    : strleft varname string n
  1122. X    Example    : strleft x LongString 5    # Will set x to "LongS"
  1123. X
  1124. X    Place leftmost n chars of string in variable varname.
  1125. X
  1126. X    STRLEN
  1127. X    Usage    : strlen varname string
  1128. X    Example    : strlen x Hello        # Will set x to "5"
  1129. X
  1130. X    Puts len of string in variable varname.
  1131. X
  1132. X    STRMID
  1133. X    Usage    : strmid varname string n1 [n2]
  1134. X    Example    : strmid x LongString 5 3    # Will set x to "Str"
  1135. X
  1136. X    Places n2 chars from string, starting at n1, in variable varname.
  1137. X    By omitting n2, you get all chars from n1 to end of string.
  1138. X
  1139. X    STRRIGHT
  1140. X    Usage    : strright varname string n
  1141. X    Example    : strright x LongString 5    # Will set x to "tring"
  1142. X
  1143. X    Place rightmost n chars of string in variable varname.
  1144. X
  1145. X    STRTAIL
  1146. X    Usage    : strtail varname breakchar string
  1147. X    Example    : strtail x . foobar.bas    # Will set x to "bas"
  1148. X
  1149. X    Remove everything before and including the breakchar in 'string' and
  1150. X    place in variable 'varname'.
  1151. X
  1152. X    SOURCE
  1153. X    Usage    : source file [arguments]
  1154. X    Example    : source mymake.sh all
  1155. X    Result    : source file 'mymake.sh' called with var _passed = 'all'
  1156. X
  1157. X    Execute commands from a file.  You can create SHELL programs in
  1158. X    a file and then execute them with this command.  Source'd files
  1159. X    have the added advantage that you can have loops in your command
  1160. X    files (see GOTO and LABEL).  You can pass SOURCE files arguments
  1161. X    by specifying arguments after the file name.  Arguments are passed
  1162. X    via the _passed variable (as a single string).
  1163. X
  1164. X    Long lines may be split by appending a backslash (\) at end of
  1165. X    first half. However, even joined lines cannot be longer than
  1166. X    ~255 chars. See example of source files.
  1167. X
  1168. X    Automatic 'sourcing' is accomplished by placing a .sh extension on
  1169. X    the file and executing it as you would a C program:
  1170. X
  1171. X    --------- file hello.sh ---------
  1172. X    foreach i ( $_passed ) "echo yo $i"
  1173. X    ---------------------------------
  1174. X
  1175. X    $ hello a b c
  1176. X    yo a
  1177. X    yo b
  1178. X    yo c
  1179. X
  1180. X    TACKON
  1181. X    Usage    : tackon var pathname filename
  1182. X    Example    : tackon x df0:c Dir    # sets x to "df0:c/Dir"
  1183. X    or    : tackon x df0: Preferences #sets x to "df0:Preferences"
  1184. X
  1185. X    Correctly adds a filename to a pathname, and puts the result in
  1186. X    variable specified.
  1187. X
  1188. X    TYPE
  1189. X    Equivalent to CAT.
  1190. X
  1191. X    TOUCH
  1192. X    Usage    : touch file1 .. fileN
  1193. X
  1194. X    Sets DateStamp on the specified files to the current date and time.
  1195. X
  1196. X    UNALIAS
  1197. X    Usage    : unalias name .. name
  1198. X    Example    : unalias vt
  1199. X
  1200. X    Delete aliases..
  1201. X
  1202. X    UNSET
  1203. X    Usage    : unset name .. name
  1204. X    Example    : unset abc
  1205. X
  1206. X    Unset one or more variables.  Deletes them entirely.
  1207. X
  1208. X    VER
  1209. X    Usage    : ver
  1210. X
  1211. X    Show current version name, & authors.
  1212. X
  1213. X    WINDOW
  1214. X    Usage    : window [-q][-f][-b][-l][-s] [dimensions]
  1215. X    Options    :
  1216. X        -f    (front) Window to front
  1217. X        -b    (back)  Window to back
  1218. X        -l    (large) Window to maximum size
  1219. X        -s    (small) Window to minimum size
  1220. X        -a    (activate)
  1221. X        -q    (query) Lists screens and windows open
  1222. X
  1223. X    Various operations on CLI window. If dimensions are specified,
  1224. X    they must be in the form x y width height, with values separated
  1225. X    by spaces.
  1226. X    The command "window -l" may be very useful on PAL machines to
  1227. X    get a full PAL window from your login sequence, or if you use
  1228. X    overscan WorkBench.
  1229. X    Option -q gives, for each Screen and Window currently open,
  1230. X    title, left edge, top edge, width, height.
  1231. X
  1232. X
  1233. XIX. SPECIAL SET VARIABLES
  1234. X    ---------------------
  1235. X
  1236. X    _prompt
  1237. X    This variable is set to the string you wish printed as your
  1238. X    prompt. This can contain escape sequences if you wish, or
  1239. X    you can include a %p in path definition to get CD in your
  1240. X    prompt.
  1241. X    Default prompt shows path specification in red pen, followed by
  1242. X    a greater (>) sign and a space.
  1243. X    The if command will set the prompt to a '_ ' if commands are
  1244. X    disabled while waiting for a 'endif' or 'else' command. Interactive
  1245. X    mode only.
  1246. X
  1247. X    _history
  1248. X    This variable is set to a numerical value, and specifies how far
  1249. X    back your history should extend.
  1250. X
  1251. X    _debug
  1252. X    Debug mode... use it if you dare.  must be set to some value
  1253. X
  1254. X    _verbose
  1255. X    Verbose mode (for source files).  display commands as they are
  1256. X    executed.
  1257. X
  1258. X    _maxerr
  1259. X    The worst (highest) return value to date.  To use this, you usually
  1260. X    set it to '0', then do some set of commands, then check it.
  1261. X
  1262. X    _lasterr
  1263. X    Return code of last command executed.  This includes internal
  1264. X    commands as well as external comands, so to use this variables
  1265. X    you must check it IMMEDIATELY after the command in question.
  1266. X
  1267. X    _cwd
  1268. X    Holds a string representing the current directory we are in from
  1269. X    root.  The SHELL can get confused as to its current directory if
  1270. X    some external program changes the directory.  Use PWD to rebuild
  1271. X    the _cwd variable in these cases.
  1272. X
  1273. X    _passed
  1274. X    This variable contains the passed arguments when you SOURCE a file
  1275. X    or execute a .sh file.  For instance:
  1276. X
  1277. X    test a b c d
  1278. X
  1279. X    -------- file test.sh ----------
  1280. X    echo $_passed
  1281. X    foreach i ( $_passed ) "echo YO $i"
  1282. X    --------------------------------
  1283. X
  1284. X    _path
  1285. X    This variable contains the search path when the shell is looking
  1286. X    for external commands.  The format is:  DIR,DIR,DIR  Each DIR must
  1287. X    have a trailing ':' or '/'.  The current directory is always
  1288. X    searched first.  The entire path will be searched first for the
  1289. X    <command>, then for <command>.sh (automatic shell script sourcing).
  1290. X
  1291. X    The default _path is set to
  1292. X        ram:,ram:c/,df0:c/,df1:c/,df0:,df1:,sys:system/
  1293. X
  1294. X    _insert
  1295. X    Sets the default for insert/overtype mode for command line
  1296. X    editing. ^A toggles between, but after <RET> the default is
  1297. X    set back as indicated by this variable. By default _insert is 1
  1298. X    indicating insert mode on setting to zero will make overtype
  1299. X    the default.
  1300. X
  1301. X    _titlebar
  1302. X    Used to set window's title bar.
  1303. X
  1304. X    _clinumber
  1305. X    Contains the number (1-20) of current CLI.
  1306. X
  1307. XX.  ADVANCED TOPICS
  1308. X    ---------------
  1309. X
  1310. X    EXCEPTION_PROCESSING:
  1311. X
  1312. X    if no _except variable exists, any command which fails causes the
  1313. X    rest of the line to abort as if an ABORTLINE had been executed.  If
  1314. X    the _except variable exists, it is of the form:
  1315. X
  1316. X    "nnn;commands..."
  1317. X
  1318. X    where nnn is some value representing the minimum return code required
  1319. X    to cause an error.  Whenever a command returns a code which is
  1320. X    larger or equal to nnn, the commands in _except are executed before
  1321. X    anything.  WHEN _except EXISTS, THE COMMAND LINE DOES NOT ABORT
  1322. X    AUTOMATICALLY.  Thus, if you want the current line being executed
  1323. X    to be aborted, the last command in _except should be an "abortline".
  1324. X
  1325. X    exception handling is disabled while in the exception handling routine
  1326. X    (thus you can't get into any infinite loops this way).
  1327. X
  1328. X    Thus if _except = ";", return codes are completely ignored.
  1329. X
  1330. X    example:
  1331. X
  1332. X    set _except "20;abortline"
  1333. X
  1334. XXI. EXAMPLE LOGIN FILE
  1335. X    ------------------
  1336. X
  1337. XIf from a CLI or the startup-script you say 'SHELL filename', that file is
  1338. Xsourced first.
  1339. XMoreover, if you have a file called S:.login, it will be sourced for every
  1340. XShell you run. This is useful for alias and setting that you want in ALL
  1341. XShells.
  1342. XIf you are a CLI user, your startup-sequence may be as simple as:
  1343. X
  1344. X    C:Shell S:login.sh
  1345. X
  1346. XHere is, my startup code:
  1347. X
  1348. X### Example S:login.sh ###
  1349. X
  1350. Xwindow -l    # if you are on a PAL machine, or use overscan
  1351. X
  1352. Xset _prompt ^[[33m[$_clinumber].%p>" "
  1353. X
  1354. Xset F5 "cdir WORK:"^M
  1355. Xset f9 "ed s:login.sh"^M
  1356. Xset F9 "ed df0:s/startup-sequence"^M
  1357. Xalias toram  "%q foreach i ( $q ) \"cp -r $i: ram:$i >NIL:;\
  1358. X    assign $i: ram:$i\""
  1359. Xalias ramop  "md RAM:op; assign OP: ram:op"
  1360. Xalias noop   "assign OP: ; rm -r ram:op"
  1361. Xalias newop  "rm -r OP:*"
  1362. Xalias dc     "dfc df0: to df1:"
  1363. Xalias go     "%q assign WORK: Boot:$q; cd WORK:; source startme.sh"
  1364. Xalias get    "%q cp $q RAM: >NIL:"
  1365. X
  1366. Xassign LC:    Stuff:c
  1367. Xassign INCLUDE:    Stuff:include
  1368. Xassign LIB:    Boot:lib
  1369. Xassign QUAD:    RAM:
  1370. X
  1371. Xrback C:FaccII; sleep 1
  1372. X    # after spawning a process, it is always better to allow it
  1373. X    # to load the command, to avoid excessive drive head movement
  1374. X
  1375. Xresident -a LC:Blink LC:lc1 LC:lc2 >NIL:
  1376. X
  1377. XC:PopCli 300 C:Newcli
  1378. XC:FF -1 Siesta.font >NIL:
  1379. XC:Patch_1 >NIL:
  1380. Xstack 8000    # lc1 and lc2 need this
  1381. X
  1382. Xsource S:setdate.sh    # this is listed in next chapter
  1383. X
  1384. X### End of example login.sh ###
  1385. X
  1386. X
  1387. XXII.  Example Source files
  1388. X      --------------------
  1389. X
  1390. XThe following is an example source file to set date and time; it may be
  1391. Xused at startup if you don't have an internal clock.
  1392. X
  1393. X### setdate.sh ###
  1394. X
  1395. Xopen CON:200/100/440/80/SetDate write 1
  1396. Xecho >.1 -n "Current date is "
  1397. Xdate >.1
  1398. Xecho >.1 -n "Please enter date: "
  1399. Xinput <.1 d
  1400. Xclose 1
  1401. Xstrlen len $d
  1402. Xif -r $len 1 > ; date $d ; endif
  1403. Xecho -n "New date: " ; date
  1404. X
  1405. X### End of setdate.sh ###
  1406. X
  1407. XNext comes a makefile that needs no Make program: may be executed from
  1408. XShell directely!!!
  1409. X
  1410. X### make.sh ###
  1411. X
  1412. Xif -t Shell.syms Shell.h; cc +HShell.syms Shell.h; rm shell.o; endif
  1413. Xif -t RAM:Shell.syms Shell.syms; cp -d Shell.syms RAM:; endif
  1414. X
  1415. Xforeach i ( main comm1 comm2 comm3 execom globals rawconsole run set \
  1416. X sub ) "if -t $i.o $i.c; echo Compile $i...;cc +IRAM:shell.syms $i.c; endif"
  1417. X
  1418. Xif -t Shell run.o main.o comm1.o comm2.o comm3.o execom.o \
  1419. Xset.o sub.o globals.o rawconsole.o
  1420. X            ln  +q -m -o Shell run.o main.o comm1.o comm2.o comm3.o\
  1421. X        execom.o set.o sub.o globals.o rawconsole.o -la -lc
  1422. Xendif
  1423. X
  1424. X### End of make.sh ###
  1425. X
  1426. X
  1427. XXIII.  Default Values
  1428. X       --------------
  1429. X
  1430. XTo make things easier, some aliases are predefined whenever you start a
  1431. Xnew Shell. These are:
  1432. X
  1433. X    - cls
  1434. X    Simply clear the screen.
  1435. X
  1436. X    - cdir
  1437. X    Use "cdir directory" to clear the screen, set CD to directory,
  1438. X    and list it.
  1439. X
  1440. X    - kr
  1441. X    Deletes everything on RAM:. If you think this is dangerous,
  1442. X    you can remove this alias.
  1443. X
  1444. X    - exit
  1445. X    Leave Shell and exit CLI.
  1446. X
  1447. XMoreover, many variables have default values, and many function keys are
  1448. Xpredefined. You can use set command to determine all of these.
  1449. X
  1450. XXIV.  Why ARP ?
  1451. X      ---------
  1452. X
  1453. XFor those of you curious enough, the A in "3.xxA" means ARP. The most
  1454. Xrecent versions of Shell use ARP.library. This has been very useful in:
  1455. X
  1456. X - Implementing commands like ASET, ASSIGN, INFO, RESIDENT, RBACK, RUN.
  1457. X - Keeping executable code small.
  1458. X
  1459. XARP.library is really public domain, so one can include it in any package,
  1460. Xboth commercial or public domain, like I am doing with Shell.
  1461. XThe ARP team is trying to wipe out the BCPL from AMIGA. This is a very
  1462. Xgood idea, I think. And there is a lot of people hoping that Commodore
  1463. Xwill put ARP.library in ROM, before or after. This would  make the AMIGA
  1464. Xa very mory friendly computer to use and program.
  1465. XI encourage programmers to get ARP development package: you can find it
  1466. Xon many BBS, and is really public domain. Users can look for a replacement
  1467. Xof C: commands from ARP (but, of course, if you use this Shell you won't
  1468. Xneed them anymore, except for ARUN).
  1469. X
  1470. END_OF_FILE
  1471. if test 44520 -ne `wc -c <'shell.doc'`; then
  1472.     echo shar: \"'shell.doc'\" unpacked with wrong size!
  1473. fi
  1474. # end of 'shell.doc'
  1475. fi
  1476. echo shar: End of archive 4 \(of 4\).
  1477. cp /dev/null ark4isdone
  1478. MISSING=""
  1479. for I in 1 2 3 4 ; do
  1480.     if test ! -f ark${I}isdone ; then
  1481.     MISSING="${MISSING} ${I}"
  1482.     fi
  1483. done
  1484. if test "${MISSING}" = "" ; then
  1485.     echo You have unpacked all 4 archives.
  1486.     rm -f ark[1-9]isdone
  1487. else
  1488.     echo You still need to unpack the following archives:
  1489.     echo "        " ${MISSING}
  1490. fi
  1491. ##  End of shell archive.
  1492. exit 0
  1493. -- 
  1494. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  1495.     amiga@cs.odu.edu    
  1496. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  1497. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  1498.  
  1499. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  1500. (only use ``amiga'' for submissions) at the above addresses.
  1501.